
package node;

import java.rmi.NoSuchObjectException;
import java.rmi.server.UnicastRemoteObject;

/**
 * This class is for shutting down the last node (trying to put a sleep) . 
 * Only the last node will use this thread.
 * @author Group 6
 * @version Spring 2013.
 *
 */
public class ShutDownThread implements Runnable
{
 // The node.
  private final Node my_node;
/**
 * 
 * @param the_node .
 */
  public ShutDownThread(Node the_node)
  {
    
    my_node = the_node;
  }

  @Override
  public void run()
  {
    
    try
    {
      Thread.sleep(10000);
      UnicastRemoteObject.unexportObject(my_node, true);
      System.exit(0);
    }
    catch (NoSuchObjectException e)
    {
     
      e.printStackTrace();
    }
    catch (InterruptedException e)
    {
    
      e.printStackTrace();
    }
  }

}
